<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 300px;
        }
    </style>
</head>

<body>
    <button id="karry">王俊凯</button>
    <button id="bai">白敬亭</button>
    <br />
    <img src="img/karry.jpg" alt="" title="王俊凯">
    <script>
        // 修改元素属性： ele.属性 = value  如src,title,id,name,href
        let karry = document.querySelector('#karry');
        let bai = document.querySelector('#bai');
        let img = document.querySelector('img');
        console.log(img.src);
        console.log(img.title);
        karry.onclick = function () {
            img.src = 'img/karry.jpg';
            img.title = '王俊凯';
        }
        bai.onclick = function () {
            img.src = 'img/bai.jpg';
            img.title = '白敬亭';
        }
    </script>
</body>

</html>